﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace childcare
{
    public partial class frmdanhsachsinhvien : Form
    {
        SqlConnection con = new SqlConnection();
        private DataTable dt = new DataTable();
        private SqlDataAdapter da = new SqlDataAdapter();
        private Boolean kt;
        public frmdanhsachsinhvien()
        {
            InitializeComponent();
        }
        private bool test()
        {
            kt = true;
            if (cbo_timkem.Text == "")
            {
                MessageBox.Show("Bạn phải lớp cần in danh sách vào", "THÔNG BÁO", MessageBoxButtons.OK);
                kt = false;
                cbo_timkem.Focus();
            }
            return kt;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string connect = @"Data Source=BLACK-PC\SQLEXPRESS;Initial Catalog=Childcare;Integrated Security=True";
            con = new SqlConnection(connect);
            connectdatabase.Openconnect();
            //dgvchildren.DataSource = connectdatabase.ex("select * from children");
            test();
            if (kt == true)
             {
                 Form1 frm = new Form1(connectdatabase.ex("select * from children where CL_ID = '" + cbo_timkem.Text + "'"));
                 frm.Show();
            }
        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void frmdanhsachsinhvien_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'childcareDataSet4._class' table. You can move, or remove it, as needed.
            this.classTableAdapter2.Fill(this.childcareDataSet4._class);
            // TODO: This line of code loads data into the 'childcareDataSet1.children' table. You can move, or remove it, as needed.
            this.childrenTableAdapter.Fill(this.childcareDataSet1.children);
            // TODO: This line of code loads data into the 'childcareDataSet1._class' table. You can move, or remove it, as needed.
            this.classTableAdapter1.Fill(this.childcareDataSet1._class);
            // TODO: This line of code loads data into the 'childcareDataSet._class' table. You can move, or remove it, as needed.
            this.classTableAdapter.Fill(this.childcareDataSet._class);

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmbaocao _frm = new frmbaocao();
            _frm.Show();
        }
    }
}
